import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/store.js'
Vue.use(Vuex)
const TTTTOKEN = 'tt-token'
export default new Vuex.Store({
  state: {
    user: getItem(TTTTOKEN)
  },
  mutations: {
    setUser(state, data) {
      state.user = data
      // localStorage.setItem(TTTTOKEN, JSON.stringify(data))
      // localStorage[TTTTOKEN] = JSON.stringify(data)
      setItem(TTTTOKEN, data)
    }
  },
  actions: {
  },
  modules: {
  }
})
